<?php 
//print_r($HttpResult);
if(1==2){$HttpResult = new HttpResult();}
	
	  $HttpContentResult = $HttpResult->getHttpContentResult();
	  //Debug::print_r($HttpResult);
	  //$lang = Config::DEFAULT_LOCALE;
		$head = new HtmlHeader($HttpContentResult->getHeader());
		$head->addCSS('reset');
		$head->addCSS('print','', 'print');
		$head->addCSS('ie',  'css/ie', 'print',true);
		
		$head->addCSS('forum',"css/admin");		
		
		//<!-- PROGRAMACAO JS | JQUERY  -->
		$head->addJS(array('jquery', 'masked'));
		
    //MENU DROPDOWN
    $head->addJS('Menu principal','js/menu/ddsmoothmenu');
    $head->addCSS('Menu CSS','js/menu/ddsmoothmenu');
    
    //TINYMCE
    $head->addJS('tinymce','js/tinymce/jquery.tinymce');
    
    //FILEUPLOAD
    $head->addJS('so','js/uploadify/swfobject');
    $head->addJS('uploadify','js/uploadify/jquery.uploadify.v2.1.4.min');
    $head->addCSS('Upload CSS','js/uploadify/uploadify');
		       
		//SLIDER SHOW
		$head->addJS('cycle', 'js/cycle/jquery.cycle.min');
	
		//<!-- JQUERY UI  -->
		$head->addJS('UI', 'js/UI/js/jquery-ui-1.8.6.custom.min');
		$head->addCSS('UI','js/UI/css/smoothness/jquery-ui-1.8.6.custom');
		
     //SELECTMENU
    $head->addJS('selectmenu','js/UI/development-bundle/ui/jquery.ui.selectmenu');
    $head->addCSS('selectmenu CSS','js/UI/css/jquery.ui.selectmenu');
    
		//<!-- VTIP  -->
		$head->addJS('vtip', 'js/vtip/vtip');
		$head->addCSS('vtip', 'js/vtip/vtip');
		
		//<!-- TABLE SORTER -->
		$head->addJS('tablesorter', 'js/tablesorter/tablesorter');
		$head->addCSS('tablesorter', 'js/tablesorter/tablesorter');
    
    //<!-- PROGRAMACAO JS | JQUERY  -->
    $head->addJS(array('admin','admin_select'));
		
		$header_html = $head->show(TRUE);
$header_html = str_replace(array("democrart", "democrArt", "Democrart", "DemocrArt"), array("expressaoartistica", "Expressão Artística", "Expressão Artística", "Expressão Artística"), $header_html);
echo $header_html;
		
		include_once "library/democrart/modules/content/dao/ContentDemoDAO.class.php";
		include_once "library/facil3/core/modules/category/dao/CategoryDAO.class.php";
		include_once "library/e_commerce/modules/banner/vo/BannerConfigVO.class.php";
		$ContentDemoDAO = ContentDemoDAO::getInstance();
		$CategoryDAO = CategoryDAO::getInstance();
		
		$CategoryVO = new BannerConfigVO();
		
		$CategoryVO->setId(20, TRUE);
		$transitionType 			= $CategoryVO->getTransitionType();//o padrao é 2
		$transitionDelayTimeFixed 	= $CategoryVO->getTransitionDelayTimeFixed();

?>

<body>

<?php  include Config::getFolderView("parts/admin/header.php"); ?>
<div id="main"> 
	
    <div id="main_content">
         
      <?php 

      if(isset($HttpContentResult->url_insert)){
        echo "<a href=\"{$HttpContentResult->url_insert}\" class=\"btn right btb\">Adicionar banner »</a>";
      } ?>
    
    <input id="category_id" type="hidden" value="<?php echo $this->category_id ?>" />
    
    <p class="success message">Você pode ordernar os itens da lista bastando, para tanto, arrastar a linha para a posição desejada!</p>
    
   	<table class="grid">
      <thead>
 <?php 
 	//Loop de fiels para as colunas da tabela - criando a primeira linha
 	echo "	<tr>";
	foreach($HttpContentResult->selectData->fields as $field){
 		if(isset($field->visible) && $field->visible == TRUE && $field->name != "go_to_location" ){
 			echo '	<th class="'.$field->type.'">';
 			//aqui é o título da tabela (coluna)
			echo $field->label;
			echo '	</th>';
		}
	}
	echo "		<th>Editar</th>";
	echo "		<th>Excluir</th>";
	echo "	</tr>";
  echo "</thead><tbody>";
	//loop de contents - linha a linha
	for($i = 0; $HttpContentResult->selectData->count_total>$i; $i++){
		//nova linha
		echo "<tr>";
		$edit 	= "";
 		$delete = "";
		foreach($HttpContentResult->selectData->fields as $field){
 			//varrendo as colunas - fields
				if($field->name == "id"){
					//se esse field dessa coluna for "id", 
					$id = $field->value[$i];
				}
		 		if($field->visible == TRUE){
		 			switch($field->type){
						case "simpleText":
		 					echo '<td>';
							echo $field->value[$i];
							echo '</td>';
							break;
							
						case "checkbox":
		 					echo '<td>';
							echo $field->value[$i];
							echo '</td>';
							break;	
						
						case "multiCheckbox":
							echo "";
							break;
							
						case "text":
							echo "";
							break;
						
						case "htmlText":
							echo "";
							echo "";
							break;
						
						case "date":
		 					echo '<td>';
							echo date("d-m-Y",strtotime($field->value[$i]));
							echo '</td>';
							break;
							
						case "url":
							
							$edit = "<td id=\"item$id\" class=\"ico one\" ><a href='".Config::getRootPath($field->value."/edit/id.".$id)."'><img src='". Config::getImagePath("icons/edit.jpg")  . "' alt='Editar' title='' /></a></td>";
							$delete = "<td class=\"ico one\"><a onclick=\"return confirm('Tem certeza que deseja excluir este item?');\" href='".Config::getRootPath($field->value."/delete/id.".$id)."'><img src='". Config::getImagePath("icons/delete.jpg")  ."' alt='Editar' title='' /></a></td>";
							break;
					}
		 		}
		 		
		}
		echo $edit;
		echo $delete;
		echo "</tr>";
	}
 ?>  
     </tbody>
		 </table> 

    </div>
    
</div>

<?php  include Config::getFolderView("parts/admin/footer.php"); ?>
